package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.FoodRetained;
import com.ruoyi.process.mapper.FoodRetainedMapper;
import com.ruoyi.process.service.IFoodRetainedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 食品留样记录Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class FoodRetainedServiceImpl implements IFoodRetainedService {
    @Resource
    private FoodRetainedMapper foodRetainedMapper;

    /**
     * 查询食品留样记录
     *
     * @param id 食品留样记录主键
     * @return 食品留样记录
     */
    @Override
    public FoodRetained selectFoodRetainedById(Long id) {
        return foodRetainedMapper.selectFoodRetainedById(id);
    }

    /**
     * 查询食品留样记录列表
     *
     * @param foodRetained 食品留样记录
     * @return 食品留样记录
     */
    @Override
    public List<FoodRetained> selectFoodRetainedList(FoodRetained foodRetained) {
        return foodRetainedMapper.selectFoodRetainedList(foodRetained);
    }

    /**
     * 新增食品留样记录
     *
     * @param foodRetained 食品留样记录
     * @return 结果
     */
    @Override
    public int insertFoodRetained(FoodRetained foodRetained) {
        foodRetained.setCreateTime(DateUtils.getNowDate());
        return foodRetainedMapper.insertFoodRetained(foodRetained);
    }

    /**
     * 修改食品留样记录
     *
     * @param foodRetained 食品留样记录
     * @return 结果
     */
    @Override
    public int updateFoodRetained(FoodRetained foodRetained) {
        foodRetained.setUpdateTime(DateUtils.getNowDate());
        return foodRetainedMapper.updateFoodRetained(foodRetained);
    }

    /**
     * 批量删除食品留样记录
     *
     * @param ids 需要删除的食品留样记录主键
     * @return 结果
     */
    @Override
    public int deleteFoodRetainedByIds(Long[] ids) {
        return foodRetainedMapper.deleteFoodRetainedByIds(ids);
    }

    /**
     * 删除食品留样记录信息
     *
     * @param id 食品留样记录主键
     * @return 结果
     */
    @Override
    public int deleteFoodRetainedById(Long id) {
        return foodRetainedMapper.deleteFoodRetainedById(id);
    }
}
